/**
 * 
 */
package com.ibtest;

import java.util.Iterator;
import java.util.List;

import org.apache.log4j.Logger;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.dao.support.DaoSupport;

import com.ibatis.sqlmap.engine.mapping.statement.PaginatedDataList;
import com.ibtest.service.ICarsService;
import com.ibtest.vo.Car;

/**
 * @author Shivakumar
 *
 */
public class CarServiceClient {

	Logger log = Logger.getLogger(this.getClass());
	@SuppressWarnings({"deprecation"})
	public CarServiceClient() {
		log.info("Starting the Car Service");
		ApplicationContext ctx = new ClassPathXmlApplicationContext(
        										"applicationContext.xml");
		
		ICarsService carService = (ICarsService)ctx.getBean("carService");
		
		//carService.addCar();
		log.info("Update output :" + carService.updateCar());
		//PaginatedDataList carList = (PaginatedDataList)carService.getAllCars();
		
		/*for(Iterator itr = (carService.getAllCars()).iterator(); itr.hasNext();) {
			log.info(itr.next());
		}*/
		log.info("All Car info:" + carService.getAllCars());
		
		//log.info("Page Size:" +carList.getPageSize());
		/*while((carList.nextPage())) {
			log.info("List size:" + carList.size());
			for(Iterator itr = carList.iterator(); itr.hasNext();) {
				log.info(((Car)itr.next()).toString());
			}
		}*/
		
		log.info("Cars from :" + carService.getCar());
	}
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		new CarServiceClient();
	}

}
